<template>
  <div>
    <el-form ref="form" :model="user" label-width="120px">
      <el-form-item :label="$t('container_Command')">
        <el-select v-show="!user.diyCommand" v-model="user.command" placeholder="请选择指令运行位置">
          <el-option label="/bin/ash" value="/bin/ash"></el-option>
          <el-option label="/bin/bash" value="/bin/bash"></el-option>
          <el-option label="/bin/sh" value="/bin/sh"></el-option>
        </el-select>
        <el-input v-show="user.diyCommand" v-model="user.command" placeholder="请输入指令运行位置"></el-input>
      </el-form-item>
      <el-form-item :label="$t('container_Usecustomizecommand')">
        <el-switch v-model="user.diyCommand"></el-switch>
      </el-form-item>
      <el-form-item :label="$t('container_User')">
        <el-input v-model="user.name" placeholder="root"></el-input>
      </el-form-item>
      <el-form-item>
        <el-button style="background: #067FB5; color: #fff;" size="small" @click="onSubmit">{{$t('container_Link')}}</el-button>
      </el-form-item>
    </el-form>
  </div>
</template>

<script>
export default {
  data () {
    return {
      user: {
        name: '',
        command: '/bin/bash',
        diyCommand: false
      }
    }
  },
  methods: {
    // 建立连接，把信息传给父组件
    onSubmit () {
      this.$emit('submit', this.user)
    }
  }
}
</script>
